<#escape x as x?xml>
<?xml version ="1.0" ?>
<category id="${entity.id}">
    <title>${entity.title}</title>
    <fullTitle>${stripCategory(entity.fullTitle)}</fullTitle>
    <description>${entity.description!}</description>
    <bigBoxUrl>${entity.bigBoxUrl!}</bigBoxUrl>
    <bannerAdUrl>${entity.bannerAdUrl!}</bannerAdUrl>
    <bannerAdUrlForIPhone>${entity.bannerAdUrlForIPhone!}</bannerAdUrlForIPhone>
    <thumbnailUrl>${entity.thumbnailUrl!}</thumbnailUrl>
    <groupLevel>${entity.groupLevel!}</groupLevel>
    <groupOrder>${entity.groupOrder!}</groupOrder>
    <child_categories>
        <#list entity.children as child>
        <category id="${child.id}">
            <title>${child.title}</title>
            <fullTitle>${stripCategory(child.fullTitle)}</fullTitle>
            <thumbnailUrl>${child.thumbnailUrl!}</thumbnailUrl>
        </category>
        </#list>
    </child_categories>
</category>
</#escape>

<#function stripCategory fullTitle>
	<#local ft = fullTitle>
    <#if fullTitle?starts_with("Shows/Shows")>
    	<#local ft = fullTitle?replace('Shows/Shows', 'Shows', 'f')>
    <#elseif fullTitle?starts_with("Radio/Shows")>
    	<#local ft = fullTitle?replace('Radio/Shows', 'Radio', 'f')>
    </#if>
    <#return ft>
</#function>